import java.util.Scanner;

public class shiyan1_4 {
    public static void main(String[] args){
        String userInput;
        Scanner scan = new Scanner(System.in);
        userInput = scan.nextLine();
        char inpurChar[] = userInput.toCharArray();
        if(userInput.length()!=14){
            System.out.println("输入字符长度不为14");
            return;
        }
        int key[] = {6,3,0,4,5,1,2};
        for(int i = 0;i<2;i++){
            char t[]={inpurChar[i*7+0],inpurChar[i*7+1],inpurChar[i*7+2],inpurChar[i*7+3],inpurChar[i*7+4],inpurChar[i*7+5],inpurChar[i*7+6]};
            inpurChar[i*7+0]=t[key[0]];
            inpurChar[i*7+1]=t[key[1]];
            inpurChar[i*7+2]=t[key[2]];
            inpurChar[i*7+3]=t[key[3]];
            inpurChar[i*7+4]=t[key[4]];
            inpurChar[i*7+5]=t[key[5]];
            inpurChar[i*7+6]=t[key[6]];
        }
        System.out.println("加密后的数据为:");
        System.out.println(String.valueOf(inpurChar));
        for(int i = 0;i<2;i++){
            char t[]={inpurChar[i*7+0],inpurChar[i*7+1],inpurChar[i*7+2],inpurChar[i*7+3],inpurChar[i*7+4],inpurChar[i*7+5],inpurChar[i*7+6]};
            inpurChar[i*7+0]=t[2];
            inpurChar[i*7+1]=t[5];
            inpurChar[i*7+2]=t[6];
            inpurChar[i*7+3]=t[1];
            inpurChar[i*7+4]=t[3];
            inpurChar[i*7+5]=t[4];
            inpurChar[i*7+6]=t[0];
        }
        System.out.println("解密后的数据为:");
        System.out.println(String.valueOf(inpurChar));
    }
}
